#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll compute(ll x, int p) {
	ll res = 0;
	while (x % p == 0) {
		x /= p;
		res++;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;

	vector<ll> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	ll c2 = 0, c3 = 0, c5 = 0;

	for (int i = 0; i < n; i++) {
		c2 += compute(a[i], 2);
		c3 += compute(a[i], 3);
		c5 += compute(a[i], 5);
	}

	ll k = min({c2, c3, c5});

	cout << k << endl;

	return 0;
}
